#include "EffectStringTran.h"

using namespace std;

EffectStringTran* EffectStringTran::m_pSingle = NULL;



EffectStringTran::EffectStringTran()
{
	m_mapEffectString.insert(pair<string,ESelfEffectType>("ANGLE", EFFECT_ANGLE));
	m_mapEffectString.insert(pair<string,ESelfEffectType>("OVER_TURN_X", EFFECT_OVERTURN_X));
	m_mapEffectString.insert(pair<string,ESelfEffectType>("OVER_TURN_Y", EFFECT_OVERTURN_Y));
	m_mapEffectString.insert(pair<string,ESelfEffectType>("ROTATE", EFFECT_ROTATE));
	m_mapEffectString.insert(pair<string,ESelfEffectType>("SCALE_X", EFFECT_SCALE_X));
	m_mapEffectString.insert(pair<string,ESelfEffectType>("SCALE_Y", EFFECT_SCALE_Y));
	m_mapEffectString.insert(pair<string,ESelfEffectType>("FLIP_X",EFFFECT_FlipX));
	m_mapEffectString.insert(pair<string,ESelfEffectType>("FLIP_Y", EFFFECT_FlipY));
}

EffectStringTran* EffectStringTran::shareInstance()
{
	if(m_pSingle == NULL)
	{
		m_pSingle = new EffectStringTran();
	}
	return m_pSingle;
}

ESelfEffectType EffectStringTran::getEffectTypeBySting(string strName)
{
	ESelfEffectType effect_type;
	map<string, ESelfEffectType>::iterator itera;
	itera = m_mapEffectString.find(strName);
	if(itera != m_mapEffectString.end())
	{
		effect_type = itera->second;
	}
	return effect_type;
}

